#!/bin/bash -x

OUT_FILE=$1;shift
SEPERATOR=tmp.123.456.789

rm -f $OUT_FILE
files=`find . -type f | xargs`

cat > $OUT_FILE << $SEPERATOR
#!/bin/sh
# to extract, remove the header and type "sh filename"

mk_file_sys_do_it()
{
$SEPERATOR

for i in $files; do
cat >> $OUT_FILE << $SEPERATOR

echo "===========================writting $i====================================="
mkdir -p `dirname $i`
`echo -n "cat >> $i << $SEPERATOR"`
`cat $i`
`echo -n $SEPERATOR`
echo "===============================DONE========================================="
$SEPERATOR
done

cat >> $OUT_FILE << $SEPERATOR
}
mk_file_sys_do_it

$SEPERATOR
